<?php
    class test_upload_controller extends controllerBase
    {
        public function process()
        {
            if(isset($_POST['title']))
            {
                $this->aParams['title'] = $_POST['title'];

                // Edit upload location here
                $destination_path = getcwd().DIRECTORY_SEPARATOR;

                $result = 0;
                $file_name=$_FILES['avatar']['name'];
                $target_path = $destination_path . basename( $_FILES['avatar']['name']);

                if(@move_uploaded_file($_FILES['avatar']['tmp_name'], "upload/".$_FILES["avatar"]["name"])) {
                    echo "<h1>OK</h1>";
                    /**
                    * Code here 
                    */
                    header('location:'.URL::getLink('test/index'));
                }
                else
                {
                    $this->aParams['error'] = 'da co loi phat sinh';
                }
            }
        }
    }
?>
